#include <stdio.h>
#include <stdlib.h>

int main()
{
        int num;
        scanf ( "%d", &num );
        if ( num == 0 ) {
                printf ( "%d\n", 10 );
        } else if ( num < 10 ) {
                printf ( "%d\n", num );
        } else  {
                int size = 4, actual_size = 0, start = 9, stop = 1, tmp_num = num, i;
                int* digits = malloc ( size * sizeof ( int ) );
                for ( i = start; i > stop; i-- ) {
                        while ( tmp_num % i == 0 ) {
                                if ( actual_size == size ) {
                                        size = size * 3 / 2;
                                        digits = ( int* ) realloc ( digits, size * sizeof ( int ) );
                                }
                                digits[actual_size++] = i;
                                tmp_num /= i;
                        }
                }
                if ( tmp_num > 10 ) {
                        printf ( "-1" );
                } else {
                        for ( i = actual_size - 1; i >= 0; i-- ) {
                                printf ( "%d", digits[i] );
                        }
                }
                free ( digits );
                printf ( "\n" );


        }
        return 0;
}
